{% load i18n %}
{% load extras %}

<div class="span-14">
{% for post in posts %}
    <div id="sb-post{{ post.id }}" class="span-14 last">
    {% if post.censor %}
        <div class="sb-censored">
    {% else %}
        {% ifnotequal post.abuse 0 %}
            <div class="sb-reported">
        {% endifnotequal %}
    {% endif %}

        <div id="post-rpc-feedback{{ post.id }}" class="rpc-message">
            <!-- This DIV is for RPC feedback messages for individual posts -->
        </div>

        <div class="post-header">
            <div class="post-actions">
                {% if user.is_authenticated  %}
                    <span class="popup">
                        <a href="#post-form" onclick="return do_quote('{{ post.id }}');">{% trans "quote" %}</a>
                    </span>
                {% endif %}
                {% ifequal post.user_id user.id %}
                    &#149;
                    <span title="{% trans "Edit this post.  All revisions are saved!" %}" class="popup">
                        <a href="#snap_post{{ post.id }}" onclick="toggle_edit('{{ post.id }}')">{% trans "edit post" %}</a>
                    </span>
                {% endifequal %}
                {% if user.is_staff %}
                    &#149;
                    <span title="{% trans "ADMIN: mark this post for censorship" %}" class="popup">
                        <a id="censor{{ post.id }}" href="#snap_post{{ post.id }}" onclick="set_censor('{{ post.id }}');">
                            {{ post.censor|yesno:_("uncensor,censor") }}
                        </a>
                    </span>
                {% endif %}
                {% if user.is_authenticated and not post.freespeech %}
                    &#149;
                    <span title="{% trans "Report this post for violation of forum policies." %}" class="popup">
                        <a id="abuse{{ post.id }}" href="#snap_post{{ post.id }}" onclick="set_abuse('{{ post.id }}');">{% trans "report abuse" %}</a>
                    </span>
                {% endif %}
            </div>

            <div class="post-meta">
                <a href="#snap_post{{ post.id }}" onclick="toggle_post('{{ post.id }}');">
                    <span class="popup" title="Author">{{ post.user }}</span>
                </a>
                {% if post.private.all %}
                    {% trans "to" %} {% for rec in post.private.all %}
                    {{ rec }}{% if not forloop.last %},{% endif %}
                    {% endfor %}
                {% endif %}
                <span class="timesince">
                    <span class="datetime">{{ post.date|date:"r T" }}<span class="timestamp">{{ post.date|timestamp }}</span></span>
                </span>
                <span class="post_summary" style="display:none;" id="snap_post_sum{{ post.id }}">:
                    {{ post.text|post_summary:"30"|safe }}
                </span>
            </div>
        </div>

        <div style="display:block" id="snap_post_view{{ post.id }}">
            <div class="post_text" style="display:block" id="snap_post_text{{ post.id }}">
                {{ post.text|striptags|render_post|safe }}
            </div>
            {% if post.previous %}
            <span id="post_revision_links{{ post.id }}" class="post_menuleft">
                <a href="#snap_post_view{{ post.id }}" onclick="revision('{{ post.id }}','{{ post.previous.id }}');">&#171; {% trans "previous" %}</a>
                <b style="color: #c00">{% trans "This message has been revised" %}</b>
            </span>


            <br />
            {% endif %}

            {% ifequal post.user_id user.id %}
            <div style="display:none" id="snap_post_edit{{ post.id }}">
                <form action="{% url snapboard_edit_post post.id %}" method="post">
                <p><b>{% trans "All revisions of this post are stored and publicly viewable." %}</b></p>
                <p>{{ post.get_edit_form.post }} {# TODO: what about errors? #}</p>
                <p>
                <input type="submit" value="{% trans "Update" %}" />
                <input type="hidden" name="next" value="{{ request.path }}" />
                </p>
                </form>
            </div>
            {% endifequal %}
            <br />
        </div>

    {% if post.censor %}
        </div>
    {% else %}
        {% ifnotequal post.abuse 0 %}
            </div>
        {% endifnotequal %}
    {% endif %}
    </div>
{% endfor %} {# iterate through posts #}
</div>
<!--
vim: ai ts=4 sts=4 et sw=4
-->
